package com.arvin.faceDetect.model

import java.io.File
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale

data class LogFile(
    val file: File
) {
    val name: String get() = file.name
    val size: Long get() = file.length()
    val lastModified: Long get() = file.lastModified()

    fun getFormattedSize(): String {
        return when {
            size < 1024 -> "$size B"
            size < 1024 * 1024 -> "${size / 1024} KB"
            else -> String.format("%.2f MB", size / (1024.0 * 1024.0))
        }
    }

    fun getFormattedTime(): String {
        val sdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
        return sdf.format(Date(lastModified))
    }
} 